package com.pure.common.enums;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author: zhangjl
 * @Date: 21-12-29
 * @Description:
 */
@Getter
@AllArgsConstructor
@JsonDeserialize(using = PriceTypeJsonDeserializer.class)
public enum PriceType implements BaseEnum {
    GROUP_FLOOR_PRICE((byte) 0, "集团底价"),
    COMMERCE_DEPT_FLOOR_PRICE((byte) 5, "最低商业发货价"),
    SUCC_BIDDER_PRICE((byte) 10, "中标价"),
    DIVISION_FLOOR_PRICE((byte) 15, "事业部最低发货价"),
    AGENT_FLOOR_PRICE((byte) 20, "代理商最低发货价"),
    DIVISION_BUSINESS_COMPANY_FLOOR_PRICE((byte) 25, "事业部商业公司发货价"),
    DISCOUNT_PRICE_BATCH((byte) 35, "备案折扣批量编辑"),
    DIVISION_SHIPMENT_DEPOSIT_PRICE((byte) 50, "事业部发货押金价"),
    RECORD_PRICE_OF_ACCOUNT_OPENING((byte) 55, "开户备案价"),
    STANDARD_DISCOUNT_PRICE((byte) 60, "标准折扣价"),
    RECORD_DISCOUNT_PRICE_OF_ACCOUNT_OPENING((byte) 65, "开户备案折扣");

    private final Byte code;
    private final String desc;

    public static PriceType getPriceType(int code) {
        for (PriceType priceType : PriceType.values()) {
            if (priceType.getCode() == code) {
                return priceType;
            }
        }
        return null;
    }

    static {
        EnumDictRegistry.add(PriceType.class);
    }

    @Override
    public String enumName() {
        return "price-type";
    }
}
